package com.aooci.ordercat.dao;

import java.io.Serializable;
import java.util.List;

/**
 * Abstract Base DAO that contains a number of base methods that can be used for each entity
 */
public interface AbstractBaseDAO<T, K extends Serializable> extends Serializable {

	/**
	 * saves or updates the entity
	 * @param entity the entity
	 */
	public void save(T entity);

	/**
	 * deletes the entity
	 * @param entity the entity
	 */
	public void delete(T entity);

	/**
	 * finds the entity by id
	 * @param id the id 
	 * @return the entity, or null if not found
	 */
	public T findById(K id);
	
	/**
	 * finds all entities
	 * @return all entities
	 */
	public List<T> findAll();
}